import keyring
import win32cred

# 读取普通凭证
pwd = keyring.get_password(service_name="test2", username='123456')
print(pwd)

# 读取windows凭证
credentials = win32cred.CredEnumerate()
for cred in credentials:
    # win32cred.CredUnmarshalCredential(cred)
    # user_name = win32cred.CredRead(cred.)
    if cred['TargetName'] == "test":
        print("")